package com.shanjupay.user.convert;

import com.shanjupay.user.api.dto.AccountDTO;
import com.shanjupay.user.entity.Account;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

@Mapper
public interface AccountCovert {

    AccountCovert INSTANCE = Mappers.getMapper(AccountCovert.class);

    @Mappings({
            @Mapping(target="name", source="username")
    })
    AccountDTO entity2dto(Account entity);


    @Mappings({
            @Mapping(target="username", source="name")
    })
    Account dto2entity(AccountDTO dto);

}
